/*************************************************************************
	> File Name: P5723.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-14 09:49:45
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

void init_prime(int n) {
    vector<bool> flag(n);
    vector<int> prime;
    int sum = n;
    for (int i = 2; i <= n; i++) {
        if (flag[i] == 0) {
            if (sum >= i) {
                prime.push_back(i);
                sum -= i;
            } else break;
        }
        for (int j = 0; j < prime.size(); j++) {
            if (i * prime[j] > n) break;
            flag[i * prime[j]] = 1;
            if (i % prime[j] == 0) break;
        }
    }
    for (int i = 0; i < prime.size(); i++) {
        cout << prime[i] << endl;
    }
    cout << prime.size() << endl;
}

int main() {
    int L;
    cin >> L;
    init_prime(L);
    return 0;
}
